package com.xoa.controller.nccloud;

import com.alibaba.fastjson.JSON;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonObject;
import com.xoa.dao.base.BaseMapper;
import com.xoa.dao.users.UsersMapper;
import com.xoa.dao.work.WorkMapper;
import com.xoa.dao.workflow.FlowRunPrcsMapper;
import com.xoa.model.nccloud.NCCInterfaceLog;
import com.xoa.model.nccloud.NccPsninfo;
import com.xoa.model.users.Users;
import com.xoa.model.workflow.FlowFast;
import com.xoa.model.workflow.FlowRun;
import com.xoa.model.workflow.FlowRunPrcs;
import com.xoa.service.WFE.WFERunner.WFEFlowRun;

import com.xoa.service.ThreadSerivice.ThreadService;
import com.xoa.service.WFE.WFERunner.WFEFlowRunPrcs;
import com.xoa.service.WFE.WFERunner.WFERunner;
import com.xoa.service.nccloud.INCCInterFaceLogService;
import com.xoa.service.nccloud.INCCPsndocService;
import com.xoa.service.nccloud.INCCloudService;
import com.xoa.service.nccloud.impl.NCCloudServiceImpl;
import com.xoa.service.workflow.TerpServer.TerpServerService;
import com.xoa.service.workflow.flowtype.FlowRunPrcsService;
import com.xoa.service.workflow.flowtype.impl.FlowRunPrcsServiceImpl;
import com.xoa.util.AjaxJson;
import com.xoa.util.DateFormat;
import com.xoa.util.ToJson;
import com.xoa.util.common.session.SessionUtils;
import com.xoa.util.common.wrapper.BaseWrapper;
import com.xoa.util.dataSource.ContextHolder;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.*;
import java.util.regex.Pattern;

@Controller
@RequestMapping(value = "/nccloud/api")
public class NCCloudController {

    private static final String securityKey = "JbitddF5WJzBOX5mqiNQ9lN5nu4EP7jqr+h5yXtSRFE=";

    @Autowired
    private INCCloudService nccloudService;

    @Autowired
    INCCInterFaceLogService logService;

    @Autowired
    private ThreadService threadService;

    //生成待办任务
    @Autowired
    protected WFERunner wfeRunner;

    // 取待办人信息
    @Resource
    private UsersMapper usersMapper;

    // 取最大id
    @Autowired
    protected WFEFlowRun wfeFlowRun;

    @Autowired
    protected WorkMapper workMapper;
    @Autowired
    private INCCPsndocService inccPsndocService;

    @Autowired
    INCCloudService incCloudService;
    @Autowired
    FlowRunPrcsMapper flowRunPrcsMapper;

    @Autowired
    private WFEFlowRunPrcs wfeFlowRunPrcs;
    @Autowired
    INCCPsndocService psndocService;

    /*
     * 薪资发放接口
     *
     * 参数说明:   @param runId  流程实例Id
     * 参数说明:   @param runName 流程实例名称
     * 参数说明:   @param flowId  流程id
     * 参数说明:   @param prcsId  当前流程实例步骤id
     * 参数说明:   @param prcsFlag  步骤状态
     * 参数说明:   @param flowPrcs  要转交的下一步骤流程设计id
     * 参数说明:   @param beginTime  流程实例创建时间
     * 参数说明:   @param beginUser 流程发起人id     并发  1，2
     * 参数说明:   @param jingbanUser  经办人         并发   1，2，3，|4，5，6
     * 参数说明:   @param currentPrcsId  当前流程设计步骤id
     * 参数说明:   @param flowStep  当前流程实例步骤id
     * */
    @RequestMapping(value = "xzff", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    public String xzff(@RequestBody Map<String, String> body, HttpServletRequest request) throws Exception {


        /*if(true){
            String json =incCloudService.dealRequestBody("{\"head\":{\"billname\":\"2月份工资\",\"cperiod\":\"02\",\"cyear\":\"2021\",\"pk_payroll\":\"1001A6100000002RE9IT\",\"yf\":\"493927.9\",\"operator\":\"雷国丽\",\"pk_org\":\"福州城市建设投资集团有限公司\",\"applydate\":\"2021-07-01\",\"sf\":\"357876.14\",\"billtype\":\"6302\",\"pk_wa_class\":\"月工资发放表\",\"billcode\":\"2021070101\",\"operator_code\":\"00004513\"},\"dept_sum\":[{\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"200\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"15604\",\"考勤扣款\":\"null\",\"deptcode\":\"01\",\"职级\":\"null\",\"养老保险（个人）\":\"null\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"null\",\"学历补贴\":\"600\",\"岗位工资\":\"11974\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"36953.57\",\"orgcode\":\"1\",\"薪级\":\"null\",\"基础保障\":\"6880\",\"deptname\":\"办公室\",\"工龄/司龄工资\":\"370\",\"psnnum\":\"4\",\"基本工资\":\"null\"},{\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"26386\",\"考勤扣款\":\"null\",\"deptcode\":\"02\",\"职级\":\"null\",\"养老保险（个人）\":\"null\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"null\",\"学历补贴\":\"1200\",\"岗位工资\":\"18455\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"53136.92\",\"orgcode\":\"1\",\"薪级\":\"null\",\"基础保障\":\"10320\",\"deptname\":\"财务部（资金结算中心）\",\"工龄/司龄工资\":\"510\",\"psnnum\":\"6\",\"基本工资\":\"null\"},{\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"300\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"24024\",\"考勤扣款\":\"null\",\"deptcode\":\"03\",\"职级\":\"null\",\"养老保险（个人）\":\"null\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"null\",\"学历补贴\":\"700\",\"岗位工资\":\"14804\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"40446.4\",\"orgcode\":\"1\",\"薪级\":\"null\",\"基础保障\":\"6880\",\"deptname\":\"资产管理部\",\"工龄/司龄工资\":\"415\",\"psnnum\":\"4\",\"基本工资\":\"null\"},{\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"10927\",\"考勤扣款\":\"null\",\"deptcode\":\"06\",\"职级\":\"null\",\"养老保险（个人）\":\"null\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"null\",\"学历补贴\":\"300\",\"岗位工资\":\"7285\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"18618.29\",\"orgcode\":\"1\",\"薪级\":\"null\",\"基础保障\":\"3440\",\"deptname\":\"人力资源部\",\"工龄/司龄工资\":\"275\",\"psnnum\":\"2\",\"基本工资\":\"null\"},{\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"13083\",\"考勤扣款\":\"null\",\"deptcode\":\"07\",\"职级\":\"null\",\"养老保险（个人）\":\"null\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"null\",\"学历补贴\":\"1000\",\"岗位工资\":\"9441\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"25938.36\",\"orgcode\":\"1\",\"薪级\":\"null\",\"基础保障\":\"5160\",\"deptname\":\"党群工作部\",\"工龄/司龄工资\":\"170\",\"psnnum\":\"4\",\"基本工资\":\"null\"},{\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"19265\",\"考勤扣款\":\"null\",\"deptcode\":\"08\",\"职级\":\"null\",\"养老保险（个人）\":\"null\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"null\",\"学历补贴\":\"400\",\"岗位工资\":\"11768\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"39551.77\",\"orgcode\":\"1\",\"薪级\":\"null\",\"基础保障\":\"5160\",\"deptname\":\"纪检监察部\",\"工龄/司龄工资\":\"215\",\"psnnum\":\"3\",\"基本工资\":\"null\"},{\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"200\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"19705\",\"考勤扣款\":\"null\",\"deptcode\":\"09\",\"职级\":\"null\",\"养老保险（个人）\":\"null\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"null\",\"学历补贴\":\"800\",\"岗位工资\":\"11923\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"37503.73\",\"orgcode\":\"1\",\"薪级\":\"null\",\"基础保障\":\"5160\",\"deptname\":\"战略发展部\",\"工龄/司龄工资\":\"200\",\"psnnum\":\"3\",\"基本工资\":\"null\"},{\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"14533\",\"考勤扣款\":\"null\",\"deptcode\":\"10\",\"职级\":\"null\",\"养老保险（个人）\":\"null\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"null\",\"学历补贴\":\"800\",\"岗位工资\":\"9691\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"26984.09\",\"orgcode\":\"1\",\"薪级\":\"null\",\"基础保障\":\"5160\",\"deptname\":\"资本运作部\",\"工龄/司龄工资\":\"160\",\"psnnum\":\"3\",\"基本工资\":\"null\"},{\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"4312\",\"考勤扣款\":\"null\",\"deptcode\":\"11\",\"职级\":\"null\",\"养老保险（个人）\":\"null\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"null\",\"学历补贴\":\"600\",\"岗位工资\":\"4312\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"13893.47\",\"orgcode\":\"1\",\"薪级\":\"null\",\"基础保障\":\"3440\",\"deptname\":\"风控法务部\",\"工龄/司龄工资\":\"155\",\"psnnum\":\"3\",\"基本工资\":\"null\"},{\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"7533\",\"考勤扣款\":\"null\",\"deptcode\":\"12\",\"职级\":\"null\",\"养老保险（个人）\":\"null\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"null\",\"学历补贴\":\"400\",\"岗位工资\":\"5882\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"18797.03\",\"orgcode\":\"1\",\"薪级\":\"null\",\"基础保障\":\"3440\",\"deptname\":\"信息化中心\",\"工龄/司龄工资\":\"100\",\"psnnum\":\"2\",\"基本工资\":\"null\"},{\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"10214\",\"考勤扣款\":\"null\",\"deptcode\":\"13\",\"职级\":\"null\",\"养老保险（个人）\":\"null\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"null\",\"学历补贴\":\"300\",\"岗位工资\":\"6810\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"20470.5\",\"orgcode\":\"1\",\"薪级\":\"null\",\"基础保障\":\"3440\",\"deptname\":\"总工办\",\"工龄/司龄工资\":\"235\",\"psnnum\":\"2\",\"基本工资\":\"null\"},{\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"2453\",\"考勤扣款\":\"null\",\"deptcode\":\"14\",\"职级\":\"null\",\"养老保险（个人）\":\"null\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"null\",\"学历补贴\":\"200\",\"岗位工资\":\"2453\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"7511.88\",\"orgcode\":\"1\",\"薪级\":\"null\",\"基础保障\":\"1720\",\"deptname\":\"审计部\",\"工龄/司龄工资\":\"65\",\"psnnum\":\"1\",\"基本工资\":\"null\"},{\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"8924\",\"考勤扣款\":\"null\",\"deptcode\":\"15\",\"职级\":\"null\",\"养老保险（个人）\":\"null\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"null\",\"学历补贴\":\"500\",\"岗位工资\":\"5954\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"18070.13\",\"orgcode\":\"1\",\"薪级\":\"null\",\"基础保障\":\"3440\",\"deptname\":\"党委宣传部\",\"工龄/司龄工资\":\"165\",\"psnnum\":\"2\",\"基本工资\":\"null\"}],\"bodys\":[{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"2156\",\"考勤扣款\":\"null\",\"职级\":\"科员\",\"psncode\":\"001893\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"9433.8\",\"学历补贴\":\"200\",\"岗位工资\":\"2156\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"6905.01\",\"薪级\":\"一档\",\"psnname\":\"单竞\",\"基础保障\":\"1720\",\"deptname\":\"办公室\",\"工龄/司龄工资\":\"55\",\"基本工资\":\"null\"},{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"3963\",\"考勤扣款\":\"null\",\"职级\":\"主办科员\",\"psncode\":\"001938\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"12280.9\",\"学历补贴\":\"200\",\"岗位工资\":\"2644\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"8790.15\",\"薪级\":\"一档\",\"psnname\":\"李美雅\",\"基础保障\":\"1720\",\"deptname\":\"办公室\",\"工龄/司龄工资\":\"65\",\"基本工资\":\"null\"},{\"postname\":\"主任\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"200\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"8695\",\"考勤扣款\":\"null\",\"职级\":\"中层正职\",\"psncode\":\"001939\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"20964.5\",\"学历补贴\":\"200\",\"岗位工资\":\"4721\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"14856.03\",\"薪级\":\"一档\",\"psnname\":\"蔡菲男\",\"基础保障\":\"1720\",\"deptname\":\"办公室\",\"工龄/司龄工资\":\"120\",\"基本工资\":\"null\"},{\"postname\":\"工勤人员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"790\",\"考勤扣款\":\"null\",\"职级\":\"助理科员\",\"psncode\":\"10000014\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"7830\",\"学历补贴\":\"0.00000000\",\"岗位工资\":\"2453\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"6402.38\",\"薪级\":\"二档\",\"psnname\":\"林臻\",\"基础保障\":\"1720\",\"deptname\":\"办公室\",\"工龄/司龄工资\":\"130\",\"基本工资\":\"null\"},{\"postname\":\"经理\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"6964\",\"考勤扣款\":\"null\",\"职级\":\"中层副职\",\"psncode\":\"000800\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"16375\",\"学历补贴\":\"200\",\"岗位工资\":\"4641\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"10899.17\",\"薪级\":\"三档\",\"psnname\":\"林德英\",\"基础保障\":\"1720\",\"deptname\":\"财务部（资金结算中心）\",\"工龄/司龄工资\":\"150\",\"基本工资\":\"null\"},{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"4961\",\"考勤扣款\":\"null\",\"职级\":\"主办科员\",\"psncode\":\"000801\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"12736\",\"学历补贴\":\"100\",\"岗位工资\":\"3310\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"8733\",\"薪级\":\"三档\",\"psnname\":\"林恩\",\"基础保障\":\"1720\",\"deptname\":\"财务部（资金结算中心）\",\"工龄/司龄工资\":\"145\",\"基本工资\":\"null\"},{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"2572\",\"考勤扣款\":\"null\",\"职级\":\"科员\",\"psncode\":\"000802\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"9624\",\"学历补贴\":\"200\",\"岗位工资\":\"2572\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"6939.7\",\"薪级\":\"三档\",\"psnname\":\"蒋励俐\",\"基础保障\":\"1720\",\"deptname\":\"财务部（资金结算中心）\",\"工龄/司龄工资\":\"60\",\"基本工资\":\"null\"},{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"3963\",\"考勤扣款\":\"null\",\"职级\":\"主办科员\",\"psncode\":\"000804\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"11042\",\"学历补贴\":\"100\",\"岗位工资\":\"2644\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"8324.06\",\"薪级\":\"一档\",\"psnname\":\"黄琳洁\",\"基础保障\":\"1720\",\"deptname\":\"财务部（资金结算中心）\",\"工龄/司龄工资\":\"115\",\"基本工资\":\"null\"},{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"3963\",\"考勤扣款\":\"null\",\"职级\":\"主办科员\",\"psncode\":\"002240\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"11147\",\"学历补贴\":\"300\",\"岗位工资\":\"2644\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"9211.11\",\"薪级\":\"一档\",\"psnname\":\"林思扬\",\"基础保障\":\"1720\",\"deptname\":\"财务部（资金结算中心）\",\"工龄/司龄工资\":\"20\",\"基本工资\":\"null\"},{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"3963\",\"考勤扣款\":\"null\",\"职级\":\"主办科员\",\"psncode\":\"002526\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"11147\",\"学历补贴\":\"300\",\"岗位工资\":\"2644\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"9029.88\",\"薪级\":\"一档\",\"psnname\":\"魏黄恋\",\"基础保障\":\"1720\",\"deptname\":\"财务部（资金结算中心）\",\"工龄/司龄工资\":\"20\",\"基本工资\":\"null\"},{\"postname\":\"总经理助理、资产管理部经理\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"300\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"9491\",\"考勤扣款\":\"null\",\"职级\":\"中层正职\",\"psncode\":\"001894\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"19654\",\"学历补贴\":\"200\",\"岗位工资\":\"5113\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"13340.35\",\"薪级\":\"二档\",\"psnname\":\"曾云\",\"基础保障\":\"1720\",\"deptname\":\"资产管理部\",\"工龄/司龄工资\":\"130\",\"基本工资\":\"null\"},{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"3963\",\"考勤扣款\":\"null\",\"职级\":\"主办科员\",\"psncode\":\"003985\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"11072\",\"学历补贴\":\"200\",\"岗位工资\":\"2644\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"8639.54\",\"薪级\":\"一档\",\"psnname\":\"林睿媛\",\"基础保障\":\"1720\",\"deptname\":\"资产管理部\",\"工龄/司龄工资\":\"45\",\"基本工资\":\"null\"},{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"3963\",\"考勤扣款\":\"null\",\"职级\":\"主办科员\",\"psncode\":\"01925\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"11107\",\"学历补贴\":\"200\",\"岗位工资\":\"2644\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"7834.28\",\"薪级\":\"一档\",\"psnname\":\"程雯宁\",\"基础保障\":\"1720\",\"deptname\":\"资产管理部\",\"工龄/司龄工资\":\"80\",\"基本工资\":\"null\"},{\"postname\":\"副经理\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"6607\",\"考勤扣款\":\"null\",\"职级\":\"中层副职\",\"psncode\":\"01926\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"15925\",\"学历补贴\":\"100\",\"岗位工资\":\"4403\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"10632.23\",\"薪级\":\"二档\",\"psnname\":\"詹清\",\"基础保障\":\"1720\",\"deptname\":\"资产管理部\",\"工龄/司龄工资\":\"160\",\"基本工资\":\"null\"},{\"postname\":\"经理\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"6964\",\"考勤扣款\":\"null\",\"职级\":\"中层副职\",\"psncode\":\"01916\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"16385\",\"学历补贴\":\"200\",\"岗位工资\":\"4641\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"10872.13\",\"薪级\":\"三档\",\"psnname\":\"王晓晖\",\"基础保障\":\"1720\",\"deptname\":\"人力资源部\",\"工龄/司龄工资\":\"160\",\"基本工资\":\"null\"},{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"3963\",\"考勤扣款\":\"null\",\"职级\":\"主办科员\",\"psncode\":\"01917\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"11042\",\"学历补贴\":\"100\",\"岗位工资\":\"2644\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"7746.16\",\"薪级\":\"一档\",\"psnname\":\"陈伟\",\"基础保障\":\"1720\",\"deptname\":\"人力资源部\",\"工龄/司龄工资\":\"115\",\"基本工资\":\"null\"},{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"0.00000000\",\"考勤扣款\":\"null\",\"职级\":\"null\",\"psncode\":\"003981\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"2815\",\"学历补贴\":\"300\",\"岗位工资\":\"0.00000000\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"416.59\",\"薪级\":\"null\",\"psnname\":\"林景\",\"基础保障\":\"0.00000000\",\"deptname\":\"党群工作部\",\"工龄/司龄工资\":\"15\",\"基本工资\":\"null\"},{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"2156\",\"考勤扣款\":\"null\",\"职级\":\"科员\",\"psncode\":\"01898\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"8767\",\"学历补贴\":\"200\",\"岗位工资\":\"2156\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"6565.3\",\"薪级\":\"一档\",\"psnname\":\"林凯堃\",\"基础保障\":\"1720\",\"deptname\":\"党群工作部\",\"工龄/司龄工资\":\"35\",\"基本工资\":\"null\"},{\"postname\":\"主任\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"6964\",\"考勤扣款\":\"null\",\"职级\":\"中层副职\",\"psncode\":\"01899\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"16315\",\"学历补贴\":\"200\",\"岗位工资\":\"4641\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"10788.15\",\"薪级\":\"三档\",\"psnname\":\"林露曦\",\"基础保障\":\"1720\",\"deptname\":\"党群工作部\",\"工龄/司龄工资\":\"90\",\"基本工资\":\"null\"},{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"3963\",\"考勤扣款\":\"null\",\"职级\":\"主办科员\",\"psncode\":\"01900\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"11157\",\"学历补贴\":\"300\",\"岗位工资\":\"2644\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"8168.32\",\"薪级\":\"一档\",\"psnname\":\"蔡华富\",\"基础保障\":\"1720\",\"deptname\":\"党群工作部\",\"工龄/司龄工资\":\"30\",\"基本工资\":\"null\"},{\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"6607\",\"考勤扣款\":\"null\",\"职级\":\"中层副职\",\"psncode\":\"01911\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"17232.1\",\"学历补贴\":\"0.00000000\",\"岗位工资\":\"4403\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"15250\",\"薪级\":\"二档\",\"psnname\":\"林峰\",\"基础保障\":\"1720\",\"deptname\":\"纪检监察部\",\"工龄/司龄工资\":\"20\",\"基本工资\":\"null\"},{\"postname\":\"主任\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"8695\",\"考勤扣款\":\"null\",\"职级\":\"中层正职\",\"psncode\":\"01913\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"20789.5\",\"学历补贴\":\"200\",\"岗位工资\":\"4721\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"14675.28\",\"薪级\":\"一档\",\"psnname\":\"郑茹\",\"基础保障\":\"1720\",\"deptname\":\"纪检监察部\",\"工龄/司龄工资\":\"145\",\"基本工资\":\"null\"},{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"3963\",\"考勤扣款\":\"null\",\"职级\":\"主办科员\",\"psncode\":\"01914\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"12265.9\",\"学历补贴\":\"200\",\"岗位工资\":\"2644\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"9626.49\",\"薪级\":\"一档\",\"psnname\":\"方婧萩\",\"基础保障\":\"1720\",\"deptname\":\"纪检监察部\",\"工龄/司龄工资\":\"50\",\"基本工资\":\"null\"},{\"postname\":\"副经理\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"200\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"6251\",\"考勤扣款\":\"null\",\"职级\":\"中层副职\",\"psncode\":\"01918\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"17282.3\",\"学历补贴\":\"300\",\"岗位工资\":\"4166\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"12338.54\",\"薪级\":\"一档\",\"psnname\":\"何标\",\"基础保障\":\"1720\",\"deptname\":\"战略发展部\",\"工龄/司龄工资\":\"70\",\"基本工资\":\"null\"},{\"postname\":\"经理\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"9491\",\"考勤扣款\":\"null\",\"职级\":\"中层正职\",\"psncode\":\"01921\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"22251.3\",\"学历补贴\":\"300\",\"岗位工资\":\"5113\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"15941.65\",\"薪级\":\"二档\",\"psnname\":\"徐小骄\",\"基础保障\":\"1720\",\"deptname\":\"战略发展部\",\"工龄/司龄工资\":\"80\",\"基本工资\":\"null\"},{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"3963\",\"考勤扣款\":\"null\",\"职级\":\"主办科员\",\"psncode\":\"01922\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"12265.9\",\"学历补贴\":\"200\",\"岗位工资\":\"2644\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"9223.54\",\"薪级\":\"一档\",\"psnname\":\"胡真\",\"基础保障\":\"1720\",\"deptname\":\"战略发展部\",\"工龄/司龄工资\":\"50\",\"基本工资\":\"null\"},{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"3963\",\"考勤扣款\":\"null\",\"职级\":\"主办科员\",\"psncode\":\"01923\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"11167\",\"学历补贴\":\"300\",\"岗位工资\":\"2644\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"7830.24\",\"薪级\":\"一档\",\"psnname\":\"李露弦\",\"基础保障\":\"1720\",\"deptname\":\"资本运作部\",\"工龄/司龄工资\":\"40\",\"基本工资\":\"null\"},{\"postname\":\"副经理（主持工作）\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"6607\",\"考勤扣款\":\"null\",\"职级\":\"中层副职\",\"psncode\":\"01924\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"15790\",\"学历补贴\":\"300\",\"岗位工资\":\"4403\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"10588.81\",\"薪级\":\"二档\",\"psnname\":\"黄籼楮\",\"基础保障\":\"1720\",\"deptname\":\"资本运作部\",\"工龄/司龄工资\":\"60\",\"基本工资\":\"null\"},{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"3963\",\"考勤扣款\":\"null\",\"职级\":\"主办科员\",\"psncode\":\"10000008\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"11087\",\"学历补贴\":\"200\",\"岗位工资\":\"2644\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"8565.04\",\"薪级\":\"一档\",\"psnname\":\"刘畅\",\"基础保障\":\"1720\",\"deptname\":\"资本运作部\",\"工龄/司龄工资\":\"60\",\"基本工资\":\"null\"},{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"2156\",\"考勤扣款\":\"null\",\"职级\":\"科员\",\"psncode\":\"001936\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"8832\",\"学历补贴\":\"200\",\"岗位工资\":\"2156\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"7045.54\",\"薪级\":\"一档\",\"psnname\":\"王恬翔\",\"基础保障\":\"1720\",\"deptname\":\"风控法务部\",\"工龄/司龄工资\":\"100\",\"基本工资\":\"null\"},{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"2156\",\"考勤扣款\":\"null\",\"职级\":\"科员\",\"psncode\":\"001947\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"9183.2\",\"学历补贴\":\"200\",\"岗位工资\":\"2156\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"7165.19\",\"薪级\":\"一档\",\"psnname\":\"陈铿安\",\"基础保障\":\"1720\",\"deptname\":\"风控法务部\",\"工龄/司龄工资\":\"20\",\"基本工资\":\"null\"},{\"postname\":\"临时负责人\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"0.00000000\",\"考勤扣款\":\"null\",\"职级\":\"null\",\"psncode\":\"01902\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"2735\",\"学历补贴\":\"200\",\"岗位工资\":\"0.00000000\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"-317.26\",\"薪级\":\"null\",\"psnname\":\"林城\",\"基础保障\":\"0.00000000\",\"deptname\":\"风控法务部\",\"工龄/司龄工资\":\"35\",\"基本工资\":\"null\"},{\"postname\":\"临时负责人\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"4961\",\"考勤扣款\":\"null\",\"职级\":\"主办科员\",\"psncode\":\"001937\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"14244.3\",\"学历补贴\":\"200\",\"岗位工资\":\"3310\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"10902.93\",\"薪级\":\"三档\",\"psnname\":\"李群\",\"基础保障\":\"1720\",\"deptname\":\"信息化中心\",\"工龄/司龄工资\":\"65\",\"基本工资\":\"null\"},{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"2572\",\"考勤扣款\":\"null\",\"职级\":\"科员\",\"psncode\":\"10000003\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"9599\",\"学历补贴\":\"200\",\"岗位工资\":\"2572\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"7894.1\",\"薪级\":\"三档\",\"psnname\":\"林晓枫\",\"基础保障\":\"1720\",\"deptname\":\"信息化中心\",\"工龄/司龄工资\":\"35\",\"基本工资\":\"null\"},{\"postname\":\"副主任\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"6251\",\"考勤扣款\":\"null\",\"职级\":\"中层副职\",\"psncode\":\"01919\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"17047.3\",\"学历补贴\":\"200\",\"岗位工资\":\"4166\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"12083.26\",\"薪级\":\"一档\",\"psnname\":\"王斌\",\"基础保障\":\"1720\",\"deptname\":\"总工办\",\"工龄/司龄工资\":\"135\",\"基本工资\":\"null\"},{\"postname\":\"副主任\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"3963\",\"考勤扣款\":\"null\",\"职级\":\"主办科员\",\"psncode\":\"01920\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"11227\",\"学历补贴\":\"100\",\"岗位工资\":\"2644\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"8387.24\",\"薪级\":\"一档\",\"psnname\":\"郑金杰\",\"基础保障\":\"1720\",\"deptname\":\"总工办\",\"工龄/司龄工资\":\"100\",\"基本工资\":\"null\"},{\"postname\":\"临时负责人\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"2453\",\"考勤扣款\":\"null\",\"职级\":\"科员\",\"psncode\":\"001935\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"10126.9\",\"学历补贴\":\"200\",\"岗位工资\":\"2453\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"7511.88\",\"薪级\":\"二档\",\"psnname\":\"张沂\",\"基础保障\":\"1720\",\"deptname\":\"审计部\",\"工龄/司龄工资\":\"65\",\"基本工资\":\"null\"},{\"postname\":\"临时负责人\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"4462\",\"考勤扣款\":\"null\",\"职级\":\"主办科员\",\"psncode\":\"01915\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"11969\",\"学历补贴\":\"200\",\"岗位工资\":\"2977\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"9011.1\",\"薪级\":\"二档\",\"psnname\":\"薛林\",\"基础保障\":\"1720\",\"deptname\":\"党委宣传部\",\"工龄/司龄工资\":\"110\",\"基本工资\":\"null\"},{\"postname\":\"职员\",\"isndebuct\":\"N\",\"医保（个人）\":\"null\",\"房租水电\":\"null\",\"扣款合计\":\"null\",\"职称工资\":\"0.00000000\",\"通讯\":\"null\",\"本次扣税\":\"0.00000000\",\"绩效工资\":\"4462\",\"考勤扣款\":\"null\",\"职级\":\"主办科员\",\"psncode\":\"10000004\",\"养老保险（个人）\":\"null\",\"plsname\":\"正式人员\",\"orgname\":\"福州城市建设投资集团有限公司\",\"应发合计\":\"12014\",\"学历补贴\":\"300\",\"岗位工资\":\"2977\",\"高温费\":\"null\",\"失业保险（个人）\":\"null\",\"实发合计\":\"9059.03\",\"薪级\":\"二档\",\"psnname\":\"许逸仙\",\"基础保障\":\"1720\",\"deptname\":\"党委宣传部\",\"工龄/司龄工资\":\"55\",\"基本工资\":\"null\"}]}", securityKey, "L4");

            return "";
        }*/

        int runId=0;
        JSONObject jsonObject=null;
        BaseWrapper baseWrapper = new BaseWrapper();
        try {
            // 接收HR的薪资发放接口数据，发到测试环境时要把注释打开
            String requstBody = body.get("requestBody");
            String rsbody = nccloudService.dealResponseBody(requstBody, securityKey, "L4");

            jsonObject = JSON.parseObject(rsbody);
            // 接口调用日志保存
            this.ncclog("","","薪资发放291推来的数据true",rsbody,"1","0");


            //薪资发放金额数据与人事档案合并
            this.payAndPsnInfo(jsonObject);
            //金额处理
            jsonObject=this.getPayDecimals(jsonObject);


            //部门和人员位置处理
            jsonObject=this.getDeptAndPsnSeat(jsonObject);



            //html拼接
            StringBuffer htmlStringBuffer=this.getHtmlAppend(jsonObject);

            // 表单发起人 -- 先默认admin 后续根据具体业务人设置
            String operator=jsonObject.getJSONObject("head").getString("operator");
            Users user = usersMapper.getUserByUserName(operator);
            if(null==user){
                throw new RuntimeException(operator+":获取申请人用户查询失败！");
            }
            // 第一步保存参数
            Integer flowId = 291;
            Integer add_prcsId = 1;
            String flowProcs = "1";
            String id = "";
            String preView = "0";

            // 参数
            String runName = "薪资发放申请表 " + DateFormat.getStrDate(new Date());
            String beginTime = DateFormat.getStrDate(new Date());
            // 下一步办理人使用userid ,根据具体的业务设置
            String beginUser = "363";
            int prcsId = 1;
            String flowPrcs = "2";
            // 下一步办理人
            String jingbanUser = "363,";
            String viewUser = "";
            Integer currentPrcsId = 1;
            String topDefault = "";
            String tabId = "";
            String tableName = "";
            String smsType = "1,";
            String orgadd = "";

            // 第一步生成工作流
            ToJson<FlowFast> toJson = wfeRunner.getWfeFlowRunInfo().workFastAdd(user, flowId, add_prcsId, flowProcs, id, request, "", runName, preView);
            FlowFast flowFast = (FlowFast) toJson.getObject();
            FlowRun flowRun = flowFast.getFlowRun();
            runId = flowRun.getRunId(); // 获取runid
            String smsContent = runName + "，流水号：" + runId;

            // 封装表单数据
            List<String> key = new ArrayList<String>(); //用于存储数据库插入的字段
            List<Object> value = new ArrayList<Object>();
            key.add("RUN_ID");
            value.add(String.valueOf(runId));
            key.add("RUN_NAME");
            value.add(runName);
            key.add("BEGIN_TIME");
            value.add(beginTime);
            key.add("BEGIN_USER");
            value.add(user.getUserId());
            key.add("DATA_2");
            value.add(htmlStringBuffer.toString()); // 转换成html的表单数据存这里
            key.add("DATA_0");
            value.add("自动发起");

            //用来存储sql传入参数 保存到表单flow_data_291
            Map<String, Object> param = new HashMap();
            param.put("tableName", "flow_data_291");
            param.put("keys", key);
            param.put("values", value);
            workMapper.insert(param);

            // 转发下一步流程
            wfeRunner.getWfeFlowRunInfo().savework(runId, runName, prcsId, flowPrcs, beginTime, beginUser,
                    jingbanUser, viewUser, user, currentPrcsId, topDefault, tabId, tableName,
                    smsContent, smsType, orgadd);

            //保存主键和类型
            this.saveBills(jsonObject.getJSONObject("head").getString("pk_payroll"),jsonObject.getJSONObject("head").getString("billtype"),Integer.toString(runId));

            //返回信息
            baseWrapper.setFlag(true);
            baseWrapper.setMsg("推送成功");
            baseWrapper.setStatus(true);
            baseWrapper.setData("{\"runId\":\""+runId+"\"}");

            // 接口调用日志保存
            this.ncclog(jsonObject.getJSONObject("head").getString("pk_payroll"),requstBody,"薪资发放291runId:"+runId+"保存单据主键和推送来的加密true","","1","0");


        }catch (Exception e){
            //返回信息
            baseWrapper.setFlag(false);
            baseWrapper.setMsg(e.getMessage());
            baseWrapper.setStatus(true);

            // 接口调用日志保存
            this.ncclog("","","薪资发放291runId:"+runId+"新建提交流程false",e.getMessage(),"0","0");


        }

        // 根据安全级别选择加密或压缩请求表体参数
        String json =incCloudService.dealRequestBody(JSON.toJSONString(baseWrapper), securityKey, "L4");
        return json;
    }



    /**
     * 薪资发放数据与人事档案合并
     * @param jsonObject
     * @return
     * @throws Exception
     */
    public void payAndPsnInfo(JSONObject jsonObject)throws Exception{
        DecimalFormat decimalFormat=new DecimalFormat("0");
        JSONArray jsonArray = jsonObject.getJSONArray("bodys");
        for (int i=0;i<jsonArray.size();i++){
            NccPsninfo nccPsninfo=new NccPsninfo();
            nccPsninfo.setApplydate(jsonObject.getJSONObject("head").getString("applydate"));
            nccPsninfo.setBasicSecurity(decimalFormat.format(Double.valueOf(jsonArray.getJSONObject(i).getString("基础保障"))));
            nccPsninfo.setSeniorityPay(decimalFormat.format(Double.valueOf(jsonArray.getJSONObject(i).getString("工龄/司龄工资"))));
            nccPsninfo.setPositionPay(decimalFormat.format(Double.valueOf(jsonArray.getJSONObject(i).getString("职称工资"))));
            nccPsninfo.setSubtotal(decimalFormat.format(Double.valueOf(jsonArray.getJSONObject(i).getString("实发合计"))));
            nccPsninfo.setPostPay(decimalFormat.format(Double.valueOf(jsonArray.getJSONObject(i).getString("岗位工资"))));
            nccPsninfo.setPerformancePay(decimalFormat.format(Double.valueOf(jsonArray.getJSONObject(i).getString("绩效工资"))));
            nccPsninfo.setEducation(decimalFormat.format(Double.valueOf(jsonArray.getJSONObject(i).getString("学历补贴"))));
            nccPsninfo.setCode(jsonArray.getJSONObject(i).getString("psncode"));
            inccPsndocService.updatePsn(nccPsninfo);
        }
    }

    //给金额变为双精度
    public JSONObject getPayDecimals(JSONObject jsonObject)throws  Exception{
        JSONObject xzffJSONObject=jsonObject;
        DecimalFormat decimalFormat=new DecimalFormat("0.00");


        JSONArray yuanGongJsonArray=jsonObject.getJSONArray("bodys");
        //员工
        for (int i=0;i<yuanGongJsonArray.size();i++){
            //获取员工json对象
            JSONObject yuanGongJsonObject = yuanGongJsonArray.getJSONObject(i);
            //将键值对以条目元素存储到set
            Set<Map.Entry<String, Object>> entrySet = yuanGongJsonObject.entrySet();
            //获取迭代器遍历entrySet的元素
            Iterator<Map.Entry<String, Object>> entryIterator = entrySet.iterator();
            while (entryIterator.hasNext()){
                //获取下一个元素
                Map.Entry<String, Object> next = entryIterator.next();
                String key=next.getKey();
                if(!key.equals("postname")&&!key.equals("isndebuct")&&!key.equals("职级")&&!key.equals("psncode")&&!key.equals("薪级")&&!key.equals("psnname")&&!key.equals("deptname")&&!key.equals("plsname")&&!key.equals("orgname")){

                    try {
                        xzffJSONObject.getJSONArray("bodys").getJSONObject(i).put(key, decimalFormat.format(Double.valueOf(next.getValue().toString())));
                    }catch (Exception e){

                    }
                }
            }

        }

        //部门

        JSONArray buMenJsonArray=jsonObject.getJSONArray("dept_sum");
        //员工
        for (int i=0;i<buMenJsonArray.size();i++){
            //获取员工json对象
            JSONObject buMenJsonObject = buMenJsonArray.getJSONObject(i);
            //将键值对以条目元素存储到set
            Set<Map.Entry<String, Object>> entrySet = buMenJsonObject.entrySet();
            //获取迭代器遍历entrySet的元素
            Iterator<Map.Entry<String, Object>> entryIterator = entrySet.iterator();
            while (entryIterator.hasNext()){
                //获取下一个元素
                Map.Entry<String, Object> next = entryIterator.next();
                String key=next.getKey();
                if(!key.equals("orgcode")&&!key.equals("deptcode")&&!key.equals("职级")&&!key.equals("薪级")&&!key.equals("deptname")&&!key.equals("orgname")&&!key.equals("psnnum")) {
                   try {
                       xzffJSONObject.getJSONArray("dept_sum").getJSONObject(i).put(key, decimalFormat.format(Double.valueOf(next.getValue().toString())));
                   }catch (Exception e){

                   }
                }
            }

        }

        return xzffJSONObject;

    }
    //部门和员工位置变换
    public JSONObject getDeptAndPsnSeat(JSONObject jsonObject)throws  Exception{
        JSONObject xzffJSONObject=jsonObject;

        //员工json对象json数组
        JSONArray yuanGongJsonArray2=new JSONArray();



        JSONArray yuanGongJsonArray=jsonObject.getJSONArray("bodys");
        //员工数组遍历
        for (int i=0;i<yuanGongJsonArray.size();i++){
            //存储员工json对象键值对
            LinkedList<Map.Entry<String,Object>> yuanGongLinkedList=new LinkedList<>();
            //获取员工json对象
            JSONObject yuanGongJsonObject = yuanGongJsonArray.getJSONObject(i);
            //将键值对以条目元素存储到set
            Set<Map.Entry<String, Object>> entrySet = yuanGongJsonObject.entrySet();
            //获取迭代器遍历entrySet的元素
            Iterator<Map.Entry<String, Object>> entryIterator = entrySet.iterator();

            //将人员放入集合第一个
            while (entryIterator.hasNext()){
                //获取下一个元素
                Map.Entry<String, Object> next = entryIterator.next();
                String key=next.getKey();
                if(key.equals("psnname")){
                    yuanGongLinkedList.addFirst(next);
                    break;
                }
            }
            //部门
            entryIterator = entrySet.iterator();
            while (entryIterator.hasNext()){
                //获取下一个元素
                Map.Entry<String, Object> next = entryIterator.next();
                String key=next.getKey();
                if(key.equals("deptname")){
                    yuanGongLinkedList.addLast(next);
                    break;
                }
            }
            //职位
            entryIterator = entrySet.iterator();
            while (entryIterator.hasNext()){
                //获取下一个元素
                Map.Entry<String, Object> next = entryIterator.next();
                String key=next.getKey();
                if(key.equals("postname")){
                    yuanGongLinkedList.addLast(next);
                    break;
                }
            }
            //职级
            entryIterator = entrySet.iterator();
            while (entryIterator.hasNext()){
                //获取下一个元素
                Map.Entry<String, Object> next = entryIterator.next();
                String key=next.getKey();
                if(key.equals("职级")){
                    yuanGongLinkedList.addLast(next);
                    break;
                }
            }
            //薪级
            entryIterator = entrySet.iterator();
            while (entryIterator.hasNext()){
                //获取下一个元素
                Map.Entry<String, Object> next = entryIterator.next();
                String key=next.getKey();
                if(key.equals("薪级")){
                    yuanGongLinkedList.addLast(next);
                    break;
                }
            }
            //基础保障
            entryIterator = entrySet.iterator();
            while (entryIterator.hasNext()){
                //获取下一个元素
                Map.Entry<String, Object> next = entryIterator.next();
                String key=next.getKey();
                if(key.equals("基础保障")){
                    yuanGongLinkedList.addLast(next);
                    break;
                }
            }
            //工龄/司龄工资
            entryIterator = entrySet.iterator();
            while (entryIterator.hasNext()){
                //获取下一个元素
                Map.Entry<String, Object> next = entryIterator.next();
                String key=next.getKey();
                if(key.equals("工龄/司龄工资")){
                    yuanGongLinkedList.addLast(next);
                    break;
                }
            }
            //职称工资
            entryIterator = entrySet.iterator();
            while (entryIterator.hasNext()){
                //获取下一个元素
                Map.Entry<String, Object> next = entryIterator.next();
                String key=next.getKey();
                if(key.equals("职称工资")){
                    yuanGongLinkedList.addLast(next);
                    break;
                }
            }
            //岗位工资
            entryIterator = entrySet.iterator();
            while (entryIterator.hasNext()){
                //获取下一个元素
                Map.Entry<String, Object> next = entryIterator.next();
                String key=next.getKey();
                if(key.equals("岗位工资")){
                    yuanGongLinkedList.addLast(next);
                    break;
                }
            }
            //绩效工资
            entryIterator = entrySet.iterator();
            while (entryIterator.hasNext()){
                //获取下一个元素
                Map.Entry<String, Object> next = entryIterator.next();
                String key=next.getKey();
                if(key.equals("绩效工资")){
                    yuanGongLinkedList.addLast(next);
                    break;
                }
            }
            //学历补贴
            entryIterator = entrySet.iterator();
            while (entryIterator.hasNext()){
                //获取下一个元素
                Map.Entry<String, Object> next = entryIterator.next();
                String key=next.getKey();
                if(key.equals("学历补贴")){
                    yuanGongLinkedList.addLast(next);
                    break;
                }
            }
            //本次扣税
            entryIterator = entrySet.iterator();
            while (entryIterator.hasNext()){
                //获取下一个元素
                Map.Entry<String, Object> next = entryIterator.next();
                String key=next.getKey();
                if(key.equals("本次扣税")){
                    yuanGongLinkedList.addLast(next);
                    break;
                }
            }
            //实发合计
            entryIterator = entrySet.iterator();
            while (entryIterator.hasNext()){
                //获取下一个元素
                Map.Entry<String, Object> next = entryIterator.next();
                String key=next.getKey();
                if(key.equals("实发合计")){
                    yuanGongLinkedList.addLast(next);
                    break;
                }
            }


            entryIterator = entrySet.iterator();
            while (entryIterator.hasNext()){
                //获取下一个元素
                Map.Entry<String, Object> next = entryIterator.next();
                String key=next.getKey();
                if(!key.equals("实发合计")&&!key.equals("本次扣税")&&!key.equals("学历补贴")&&!key.equals("绩效工资")
                        &&!key.equals("岗位工资")&&!key.equals("职称工资")&&!key.equals("工龄/司龄工资")
                        &&!key.equals("基础保障")&&!key.equals("薪级")&&!key.equals("职级")
                        &&!key.equals("postname")&&!key.equals("deptname")&&!key.equals("psnname")&&!key.equals("psncode")
                        &&!key.equals("plsname")&&!key.equals("orgname")){
                    yuanGongLinkedList.addLast(next);

                }
            }






            LinkedHashMap yuanGongLinkedHashMap=new LinkedHashMap();
            for (int a=0;a<yuanGongLinkedList.size();a++){
                yuanGongLinkedHashMap.put(yuanGongLinkedList.get(a).getKey(),yuanGongLinkedList.get(a).getValue());
            }
            //将员工json对象添加到员工json数组
            yuanGongJsonArray2.add(yuanGongLinkedHashMap);
        }




        //===========================================部门=======================================
        //部门json对象json数组
        JSONArray buMenJsonArray2=new JSONArray();


        JSONArray buMenJsonArray=jsonObject.getJSONArray("dept_sum");
        //部门数组遍历
        for (int i=0;i<buMenJsonArray.size();i++){
            //将buMenLinkedList元素添加到map
            LinkedList<Map.Entry<String,Object>> buMenLinkedList=new LinkedList<>();
            //获取部门json对象
            JSONObject buMenJsonObject = buMenJsonArray.getJSONObject(i);
            //将键值对以条目元素存储到set
            Set<Map.Entry<String, Object>> entrySet = buMenJsonObject.entrySet();
            //获取迭代器遍历entrySet的元素
            Iterator<Map.Entry<String, Object>> entryIterator = entrySet.iterator();

            //部门名称
            entryIterator = entrySet.iterator();
            while (entryIterator.hasNext()){
                //获取下一个元素
                Map.Entry<String, Object> next = entryIterator.next();
                String key=next.getKey();
                if(key.equals("deptname")){
                    buMenLinkedList.addFirst(next);
                    break;
                }
            }

            //组织名称
            entryIterator = entrySet.iterator();
            while (entryIterator.hasNext()){
                //获取下一个元素
                Map.Entry<String, Object> next = entryIterator.next();
                String key=next.getKey();
                if(key.equals("orgname")){
                    buMenLinkedList.addLast(next);
                    break;
                }
            }


            entryIterator = entrySet.iterator();
            while (entryIterator.hasNext()){
                //获取下一个元素
                Map.Entry<String, Object> next = entryIterator.next();
                String key=next.getKey();
                if(key.equals("deptcode")||key.equals("orgcode")||key.equals("职级")||key.equals("薪级")||key.equals("psnnum")){
                    buMenLinkedList.addLast(next);
                }
            }

            entryIterator = entrySet.iterator();
            //金额放在最后
            while (entryIterator.hasNext()){
                //获取下一个元素
                Map.Entry<String, Object> next = entryIterator.next();
                String key=next.getKey();
                if(!key.equals("orgcode")&&!key.equals("deptcode")&&!key.equals("职级")&&!key.equals("薪级")&&!key.equals("deptname")&&!key.equals("orgname")&&!key.equals("psnnum")){
                    buMenLinkedList.addLast(next);
                }
            }

            LinkedHashMap buMenLinkedHashMap=new LinkedHashMap();
            for (int b=0;b<buMenLinkedList.size();b++){
                buMenLinkedHashMap.put(buMenLinkedList.get(b).getKey(),buMenLinkedList.get(b).getValue());
            }
            buMenJsonArray2.add(buMenLinkedHashMap);
        }



        //将部门和人员添加到json对象
        xzffJSONObject.put("bodys",yuanGongJsonArray2);
        xzffJSONObject.put("dept_sum",buMenJsonArray2);
        return xzffJSONObject;
    }




    /**
     * 单据html拼接
     * @param jsonObject
     * @return
     * @throws Exception
     */
    public StringBuffer getHtmlAppend(JSONObject jsonObject)throws Exception{
        StringBuffer htmlStringBuffer=new StringBuffer();
        //html数据拼接
        htmlStringBuffer.append("<p>");
        htmlStringBuffer.append("    <br/>");
        htmlStringBuffer.append("</p>");
        htmlStringBuffer.append("<p style=\"text-align: center;\">");
        htmlStringBuffer.append("    <span style=\"font-size: 24px; font-family: 方正小标宋简体, FZXiaoBiaoSong-B05S;\" class=\"span_head\">薪资发放申请表</span>");
        htmlStringBuffer.append("</p>");
        htmlStringBuffer.append("<table style=\"width: 1350px; border: 2px solid rgb(0, 0, 0); margin: auto;margin-top:10px\" class=\"table_head\" data-sort=\"sortDisabled\" width=\"405\" height=\"114\" border=\"2\" align=\"center\">");
        htmlStringBuffer.append("    <tbody>");
        htmlStringBuffer.append("        <tr style=\"background-color: #f2f2f2;\" class=\"firstRow\" height=\"19\">");
        htmlStringBuffer.append("            <td  x:str=\"\" valign=\"middle\" height=\"10\" align=\"center\">");
        htmlStringBuffer.append("                单据名称<br/>");
        htmlStringBuffer.append("            </td>");
        htmlStringBuffer.append("            <td  height=\"10\">");
        htmlStringBuffer.append("                <input name=\"DATA_23\" class=\"form_item\" data-type=\"text\" type=\"text\" title=\"单据名称\" value=\""+jsonObject.getJSONObject("head").getString("billname")+"\" id=\"DATA_23\" orgfontsize=\"\" orgalign=\"left\" orgwidth=\"168\" orgheight=\"\" orghidden=\"0\" style=\"text-align: left; width: 168px;\" align=\"left\"/>");
        htmlStringBuffer.append("            </td>");
        htmlStringBuffer.append("            <td  x:str=\"\" valign=\"middle\" height=\"10\" align=\"center\">");
        htmlStringBuffer.append("                申请日期<br/>");
        htmlStringBuffer.append("            </td>");
        htmlStringBuffer.append("            <td  height=\"10\">");
        htmlStringBuffer.append("                <input name=\"DATA_24\" class=\"form_item\" data-type=\"text\" type=\"text\" title=\"申请日期\" value=\""+jsonObject.getJSONObject("head").getString("applydate")+"\" id=\"DATA_24\" orgfontsize=\"\" orgalign=\"left\" orgwidth=\"168\" orgheight=\"\" orghidden=\"0\" style=\"text-align: left; width: 168px;\" align=\"left\"/>");
        htmlStringBuffer.append("            </td>");
        htmlStringBuffer.append("            <td  x:str=\"\" valign=\"middle\" height=\"10\" align=\"center\">");
        htmlStringBuffer.append("                实发合计<br/>");
        htmlStringBuffer.append("            </td>");
        htmlStringBuffer.append("            <td style=\"border: 1px solid rgb(0, 0, 0); border-image: none; color: rgb(0, 0, 0); font-size: 15px; font-style: normal; font-weight: 400;  -ms-word-break: break-all;\" height=\"10\">");
        htmlStringBuffer.append("                <input name=\"DATA_25\" class=\"form_item\" data-type=\"text\" type=\"text\" title=\"实发合计\" value=\""+jsonObject.getJSONObject("head").getString("sf")+"\" id=\"DATA_25\" orgfontsize=\"\" orgalign=\"left\" orgwidth=\"168\" orgheight=\"\" orghidden=\"0\" style=\"text-align: left; width: 168px;\" align=\"left\"/>");
        htmlStringBuffer.append("            </td>");
        /*htmlStringBuffer.append("            <td  x:str=\"\" valign=\"middle\" height=\"10\" align=\"center\">");
        htmlStringBuffer.append("                单据类型编码<br/>");
        htmlStringBuffer.append("            </td>");
        htmlStringBuffer.append("            <td style=\"border: 1px solid rgb(0, 0, 0); border-image: none; color: rgb(0, 0, 0); font-size: 15px; font-style: normal; font-weight: 400;  -ms-word-break: break-all;\" height=\"10\">");
        htmlStringBuffer.append("                <input name=\"DATA_26\" class=\"form_item\" data-type=\"text\" type=\"text\" title=\"单据类型编码\" value=\""+jsonObject.getJSONObject("head").getString("billtype")+"\" id=\"DATA_26\" orgfontsize=\"\" orgalign=\"left\" orgwidth=\"168\" orgheight=\"\" orghidden=\"0\" style=\"text-align: left; width: 168px;\" align=\"left\"/>");
        htmlStringBuffer.append("            </td>");*/
        htmlStringBuffer.append("            <td  x:str=\"\" valign=\"middle\" height=\"10\" align=\"center\">");
        htmlStringBuffer.append("                薪资方案<br/>");
        htmlStringBuffer.append("            </td>");
        htmlStringBuffer.append("            <td style=\"border: 1px solid rgb(0, 0, 0); border-image: none; color: rgb(0, 0, 0); font-size: 15px; font-style: normal; font-weight: 400;  -ms-word-break: break-all;\" height=\"10\">");
        htmlStringBuffer.append("                <input name=\"DATA_27\" class=\"form_item\" data-type=\"text\" type=\"text\" title=\"薪资方案\" value=\""+jsonObject.getJSONObject("head").getString("pk_wa_class")+"\" id=\"DATA_27\" orgfontsize=\"\" orgalign=\"left\" orgwidth=\"168\" orgheight=\"\" orghidden=\"0\" style=\"text-align: left; width: 168px;\" align=\"left\"/>");
        htmlStringBuffer.append("            </td>");
        htmlStringBuffer.append("        </tr>");
        htmlStringBuffer.append("        <tr height=\"19\">");
        htmlStringBuffer.append("            <td  x:str=\"\" valign=\"middle\" height=\"10\" align=\"center\">");
        htmlStringBuffer.append("                年&nbsp;&nbsp;&nbsp;&nbsp; 度<br/>");
        htmlStringBuffer.append("            </td>");
        htmlStringBuffer.append("            <td  height=\"10\">");
        htmlStringBuffer.append("                <input name=\"DATA_30\" class=\"form_item\" data-type=\"text\" type=\"text\" title=\"年度\" value=\""+jsonObject.getJSONObject("head").getString("cyear")+"\" id=\"DATA_30\" orgfontsize=\"\" orgalign=\"left\" orgwidth=\"168\" orgheight=\"\" orghidden=\"0\" style=\"text-align: left; width: 168px;\" align=\"left\"/>");
        htmlStringBuffer.append("            </td>");
        htmlStringBuffer.append("            <td  x:str=\"\" valign=\"middle\" height=\"10\" align=\"center\">");
        htmlStringBuffer.append("                月&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 分<br/>");
        htmlStringBuffer.append("            </td>");
        htmlStringBuffer.append("            <td  height=\"10\">");
        htmlStringBuffer.append("                <input name=\"DATA_28\" class=\"form_item\" data-type=\"text\" type=\"text\" title=\"月份\" value=\""+jsonObject.getJSONObject("head").getString("cperiod")+"\" id=\"DATA_28\" orgfontsize=\"\" orgalign=\"left\" orgwidth=\"168\" orgheight=\"\" orghidden=\"0\" style=\"text-align: left; width: 168px;\" align=\"left\"/>");
        htmlStringBuffer.append("            </td>");
       /* htmlStringBuffer.append("            <td  x:str=\"\" valign=\"middle\" height=\"10\" align=\"center\">");
        htmlStringBuffer.append("                单据编号<br/>");
        htmlStringBuffer.append("            </td>");
        htmlStringBuffer.append("            <td  height=\"10\">");
        htmlStringBuffer.append("                <input name=\"DATA_29\" class=\"form_item\" data-type=\"text\" type=\"text\" title=\"单据编号\" value=\""+jsonObject.getJSONObject("head").getString("billcode")+"\" id=\"DATA_29\" orgfontsize=\"\" orgalign=\"left\" orgwidth=\"168\" orgheight=\"\" orghidden=\"0\" style=\"text-align: left; width: 168px;\" align=\"left\"/>");
        htmlStringBuffer.append("            </td>");*/

        htmlStringBuffer.append("            <td  x:str=\"\" valign=\"middle\" height=\"10\" align=\"center\">");
        htmlStringBuffer.append("                应发合计<br/>");
        htmlStringBuffer.append("            </td>");
        htmlStringBuffer.append("            <td  x:str=\"\" height=\"10\">");
        htmlStringBuffer.append("                <input name=\"DATA_35\" class=\"form_item\" data-type=\"text\" type=\"text\" title=\"应发合计\" value=\""+jsonObject.getJSONObject("head").getString("yf")+"\" id=\"DATA_35\" orgfontsize=\"\" orgalign=\"left\" orgwidth=\"168\" orgheight=\"\" orghidden=\"0\" style=\"text-align: left; width: 168px;\" align=\"left\"/>");
        htmlStringBuffer.append("            </td>");
        htmlStringBuffer.append("            <td  valign=\"middle\" height=\"10\" align=\"center\">");
        htmlStringBuffer.append("                申 请 人");
        htmlStringBuffer.append("            </td>");
        htmlStringBuffer.append("            <td  x:str=\"\" height=\"10\">");
        htmlStringBuffer.append("                <input name=\"DATA_36\" class=\"form_item\" data-type=\"text\" type=\"text\" title=\"申请人\" value=\""+jsonObject.getJSONObject("head").getString("operator")+"\" id=\"DATA_36\" orgfontsize=\"\" orgalign=\"left\" orgwidth=\"168\" orgheight=\"\" orghidden=\"0\" style=\"text-align: left; width: 168px;\" align=\"left\"/>");
        htmlStringBuffer.append("            </td>");
        htmlStringBuffer.append("        </tr>");
        //htmlStringBuffer.append("        <tr height=\"19\">");
       /* htmlStringBuffer.append("            <td  x:str=\"\" valign=\"middle\" height=\"10\" align=\"center\">");
        htmlStringBuffer.append("                单据主键<br/>");
        htmlStringBuffer.append("            </td>");
        htmlStringBuffer.append("            <td  height=\"10\">");
        htmlStringBuffer.append("                <input name=\"DATA_31\" class=\"form_item\" data-type=\"text\" type=\"text\" title=\"单据主键\" value=\""+jsonObject.getJSONObject("head").getString("pk_payroll")+"\" id=\"DATA_31\" orgfontsize=\"\" orgalign=\"left\" orgwidth=\"168\" orgheight=\"\" orghidden=\"0\" style=\"text-align: left; width: 168px;\" align=\"left\"/>");
        htmlStringBuffer.append("            </td>");*/

        /*htmlStringBuffer.append("            <td  valign=\"middle\" height=\"10\" align=\"center\">");
        htmlStringBuffer.append("                组织名称");
        htmlStringBuffer.append("            </td>");
        htmlStringBuffer.append("            <td  height=\"10\">");
        htmlStringBuffer.append("                <input name=\"DATA_37\" class=\"form_item\" data-type=\"text\" type=\"text\" title=\"组织名称\" value=\""+jsonObject.getJSONObject("head").getString("pk_org")+"\" id=\"DATA_37\" orgfontsize=\"\" orgalign=\"left\" orgwidth=\"168\" orgheight=\"\" orghidden=\"0\" style=\"text-align: left; width: 168px;\" align=\"left\"/>");
        htmlStringBuffer.append("            </td>");*/
        //htmlStringBuffer.append("        </tr>");


        htmlStringBuffer.append("        <tr height=\"19\">");
        htmlStringBuffer.append("            <td  x:str=\"\" rowspan=\"1\" colspan=\"8\" height=\"10\">");
        htmlStringBuffer.append("                <p>");
        htmlStringBuffer.append("                    <span style=\"cursor: pointer;font-weight: bold\"  id=\"span_yuanGongMX\" >员工明细</span>&nbsp; |&nbsp;<span  style=\"background-color: transparent;cursor: pointer\" id=\"span_buMenMX\"> 部门汇总</span>");
        htmlStringBuffer.append("                </p>");
        htmlStringBuffer.append("            </td>");
        htmlStringBuffer.append("        </tr>");
        htmlStringBuffer.append("    </tbody>");
        htmlStringBuffer.append("</table>");
        htmlStringBuffer.append("<div class=\"div_YB\">");
        //员工明细数据
        htmlStringBuffer.append("<div class=\"report-box clear\" style=\"margin: 0 auto;\" id=\"div_yuanGongMX\">");

        //=====================左表部分
        //第一部分标题
        StringBuffer stringBufferTitle=new StringBuffer();
        htmlStringBuffer.append("<div class=\"left-table\">");
        htmlStringBuffer.append(" <table class=\"table\" id=\"chanceGridTable\">");
        htmlStringBuffer.append("<tr>");

        htmlStringBuffer.append("            <td title=\"序号\">");
        htmlStringBuffer.append("                序号");
        htmlStringBuffer.append("            </td>");

        //选择员工对属性最多的作为员工标题
        Map<Integer,Object> integers = new TreeMap<>();
        for (int s=0;s<jsonObject.getJSONArray("bodys").size();s++){
            integers.put(jsonObject.getJSONArray("bodys").getJSONObject(s).size(),jsonObject.getJSONArray("bodys").getJSONObject(s));
        }
        Set<Integer> integers1 = integers.keySet();
        LinkedList<Integer> linkedList=new LinkedList<>(integers1);
        Set<String> stringSet = null;
        for (int b=0;b<jsonObject.getJSONArray("bodys").size();b++){
            if(jsonObject.getJSONArray("bodys").getJSONObject(b).size()==linkedList.getLast()){
                stringSet = jsonObject.getJSONArray("bodys").getJSONObject(b).keySet();
                break;
            }
        }




        Iterator<String> stringIterator = stringSet.iterator();
        int poll=0;
        while (stringIterator.hasNext()){
            poll++;
            String next=stringIterator.next();
            if(poll<=5){
                if(next.indexOf("postname")>-1){

                    htmlStringBuffer.append("            <td title=\"岗位名称\">");
                    htmlStringBuffer.append("                岗位名称");
                    htmlStringBuffer.append("            </td>");
                }else if(next.indexOf("isndebuct")>-1){
                    htmlStringBuffer.append("            <td title=\"是否扣除附加费用额\">");
                    htmlStringBuffer.append("                是否扣除附加费用额");
                    htmlStringBuffer.append("            </td>");
                }else if(next.indexOf("psncode")>-1){
                    htmlStringBuffer.append("            <td title=\"人员编码\">");
                    htmlStringBuffer.append("                人员编码");
                    htmlStringBuffer.append("            </td>");
                }else if(next.indexOf("psnname")>-1){
                    htmlStringBuffer.append("            <td title=\"人员名称\">");
                    htmlStringBuffer.append("                人员名称");
                    htmlStringBuffer.append("            </td>");
                }else if(next.indexOf("deptname")>-1){
                    htmlStringBuffer.append("            <td title=\"部门名称\">");
                    htmlStringBuffer.append("                部门名称");
                    htmlStringBuffer.append("            </td>");
                }else if(next.indexOf("plsname")>-1){
                    htmlStringBuffer.append("            <td title=\"人员类别\">");
                    htmlStringBuffer.append("                人员类别");
                    htmlStringBuffer.append("            </td>");
                }else if(next.indexOf("orgname")>-1){
                    htmlStringBuffer.append("            <td title=\"组织名称\">");
                    htmlStringBuffer.append("                组织名称");
                    htmlStringBuffer.append("            </td>");
                }else {
                    htmlStringBuffer.append("           <td title=\""+next+"\">");
                    htmlStringBuffer.append("                "+next+"");
                    htmlStringBuffer.append("            </td>");
                }
            }else
                //拼接右边部分的标题
                if(poll>=6){
                    if(next.indexOf("postname")>-1){

                        stringBufferTitle.append("            <td title=\"岗位名称\">");
                        stringBufferTitle.append("                岗位名称");
                        stringBufferTitle.append("            </td>");
                    }else if(next.indexOf("isndebuct")>-1){
                        stringBufferTitle.append("            <td title=\"是否扣除附加费用额\">");
                        stringBufferTitle.append("                是否扣除附加费用额");
                        stringBufferTitle.append("            </td>");
                    }else if(next.indexOf("psncode")>-1){
                        stringBufferTitle.append("            <td title=\"人员编码\">");
                        stringBufferTitle.append("                人员编码");
                        stringBufferTitle.append("            </td>");
                    }else if(next.indexOf("psnname")>-1){
                        stringBufferTitle.append("            <td title=\"人员名称\">");
                        stringBufferTitle.append("                人员名称");
                        stringBufferTitle.append("            </td>");
                    }else if(next.indexOf("deptname")>-1){
                        stringBufferTitle.append("            <td title=\"部门名称\">");
                        stringBufferTitle.append("                部门名称");
                        stringBufferTitle.append("            </td>");
                    }else if(next.indexOf("plsname")>-1){
                        stringBufferTitle.append("            <td title=\"人员类别\">");
                        stringBufferTitle.append("                人员类别");
                        stringBufferTitle.append("            </td>");
                    }else if(next.indexOf("orgname")>-1){
                        stringBufferTitle.append("            <td title=\"组织名称\">");
                        stringBufferTitle.append("                组织名称");
                        stringBufferTitle.append("            </td>");
                    }else {
                        stringBufferTitle.append("           <td title=\""+next+"\">");
                        stringBufferTitle.append("                "+next+"");
                        stringBufferTitle.append("            </td>");
                    }
                }


        }

        htmlStringBuffer.append("</tr>");
        htmlStringBuffer.append("</table>");



        //第二部分内容
        StringBuffer stringBufferContent=new StringBuffer();
        htmlStringBuffer.append("<div class=\"left-title\">");
        htmlStringBuffer.append("<table class=\"table\" id=\"chanceGridTable1\">");

        //声明数组保存金额做合计处理
        Double[] yuanGongPayDouble=null;
        //标题数据遍历
        for (int a=0;a<jsonObject.getJSONArray("bodys").size();a++){


            htmlStringBuffer.append("        <tr>");
            stringBufferContent.append("        <tr>");

            //序号
            htmlStringBuffer.append("            <td title=\""+ (a+1) +"\">");
            htmlStringBuffer.append("                " + (a+1) + "");
            htmlStringBuffer.append("            </td>");

            //json对象获取key集合
            Iterator<String> iterator = stringSet.iterator();

            //给数组初始大小根据td数量
            if(null==yuanGongPayDouble){
                yuanGongPayDouble=new Double[stringSet.size()-5];

            }

            //记录json对象key循环几次
            int zhi=0;
            //金额数组初始下标
            int indexPay=0;
            while (iterator.hasNext()){
                String next=iterator.next();


                zhi++;

                if(zhi<=5){
                    htmlStringBuffer.append("<td title=\""+ jsonObject.getJSONArray("bodys").getJSONObject(a).getString(next) +"\">");
                    if(null!=jsonObject.getJSONArray("bodys").getJSONObject(a).getString(next)&&!jsonObject.getJSONArray("bodys").getJSONObject(a).getString(next).equals("null")){
                        htmlStringBuffer.append("" + jsonObject.getJSONArray("bodys").getJSONObject(a).getString(next) + "");
                    }
                    htmlStringBuffer.append("</td>");
                }else
                if(zhi>=6){
                    stringBufferContent.append("<td title=\""+ jsonObject.getJSONArray("bodys").getJSONObject(a).getString(next) +"\">");
                    if(null!=jsonObject.getJSONArray("bodys").getJSONObject(a).getString(next)&&!jsonObject.getJSONArray("bodys").getJSONObject(a).getString(next).equals("null")){
                        stringBufferContent.append("" + jsonObject.getJSONArray("bodys").getJSONObject(a).getString(next) + "");
                    }
                    stringBufferContent.append("</td>");


                    //对每个员工金额进行计算
                    try{
                        //是不是金额true则计算否略过
                        String pay=jsonObject.getJSONArray("bodys").getJSONObject(a).getString(next);
                        if(pay.indexOf(".")>-1){
                            if(null==yuanGongPayDouble[indexPay]){
                                yuanGongPayDouble[indexPay]=0.00;
                            }
                            yuanGongPayDouble[indexPay]+=Double.valueOf(pay);
                        }else {
                            throw  new RuntimeException("表示金额出错!");
                        }
                    }catch (Exception e){
                        yuanGongPayDouble[indexPay]=null;
                    }
                    indexPay++;
                }
            }

            htmlStringBuffer.append("        </tr>");
            stringBufferContent.append("        </tr>");
        }


        htmlStringBuffer.append("<tr>" +
                "<td  colspan=\"6\"></td>" +
                "</tr>");

        htmlStringBuffer.append("<tr>");
        htmlStringBuffer.append("<td>合计</td>");
        htmlStringBuffer.append("<td></td>");
        htmlStringBuffer.append("<td></td>");
        htmlStringBuffer.append("<td></td>");
        htmlStringBuffer.append("<td></td>");
        htmlStringBuffer.append("<td></td>");
        htmlStringBuffer.append("</tr>");




        //添加最后一行来填充固定几个td
        htmlStringBuffer.append("        <tr>");
        htmlStringBuffer.append("<td style=\"visibility: hidden;\"></td>");
        htmlStringBuffer.append("<td style=\"visibility: hidden;\"></td>");
        htmlStringBuffer.append("<td style=\"visibility: hidden;\"></td>");
        htmlStringBuffer.append("<td style=\"visibility: hidden;\"></td>");
        htmlStringBuffer.append("<td style=\"visibility: hidden;\"></td>");
        htmlStringBuffer.append("<td style=\"visibility: hidden;\"></td>");
        htmlStringBuffer.append("        </tr>");

        htmlStringBuffer.append("</table>");
        htmlStringBuffer.append("</div>");
        htmlStringBuffer.append("</div>");





        //==========右边部分
        //第一部分标题
        htmlStringBuffer.append("<div class=\"right-table\">");
        htmlStringBuffer.append("<div class=\"right-title\">");
        htmlStringBuffer.append("<table class=\"table\" id=\"chanceGridTable2\">");
        htmlStringBuffer.append("<tr>");
        htmlStringBuffer.append(stringBufferTitle.toString());
        htmlStringBuffer.append("<td style=\"visibility: hidden;\"></td>");
        htmlStringBuffer.append("</tr>");


        htmlStringBuffer.append("</table>");
        htmlStringBuffer.append("</div>");





        //第二部分内容
        htmlStringBuffer.append("<div class=\"content-table\">");
        htmlStringBuffer.append("<table class=\"table\" id=\"chanceGridTable3\">");
        htmlStringBuffer.append(stringBufferContent.toString());
        htmlStringBuffer.append("<tr>" +
                "<td  colspan=\""+(stringSet.size()-5)+"\"></td>" +
                "</tr>");

        DecimalFormat decimalFormat=new DecimalFormat("0.00");
        //合计拼接

        htmlStringBuffer.append("<tr>");
        for (Double pay:yuanGongPayDouble){
            if(null!=pay){
                htmlStringBuffer.append("<td title=\""+decimalFormat.format(pay)+"\">"+decimalFormat.format(pay)+"</td>");

            }else {
                htmlStringBuffer.append("<td></td>");
            }
        }
        htmlStringBuffer.append("</tr>");
        htmlStringBuffer.append("</table>");
        htmlStringBuffer.append("</div>");
        htmlStringBuffer.append("</div>");
        htmlStringBuffer.append("</div>");



        //==================================================================================================
        //部门明细数据
        htmlStringBuffer.append(this.getDeptTable(jsonObject).toString());


        return htmlStringBuffer;
    }







    /**
     * 部门明细
     * @return
     * @throws Exception
     */
    public StringBuffer getDeptTable(JSONObject jsonObject)throws Exception{
        StringBuffer htmlStringBuffer=new StringBuffer();


        htmlStringBuffer.append("<div class=\"report-box-dept clear-dept\" style=\"margin: 0 auto;visibility:hidden\" id=\"div_buMenMX\">");

        //=====================左表部分
        //第一部分标题
        StringBuffer stringBufferTitle=new StringBuffer();
        htmlStringBuffer.append("<div class=\"left-table-dept\">");
        htmlStringBuffer.append(" <table class=\"table-dept\" id=\"chanceGridTable-dept\">");
        htmlStringBuffer.append("<tr>");

        htmlStringBuffer.append("            <td title=\"序号\">");
        htmlStringBuffer.append("                序号");
        htmlStringBuffer.append("            </td>");

        //选择员工对属性最多的作为员工标题
        Map<Integer,Object> integers = new TreeMap<>();

        //循环遍历获取部门对象键数量存入integers，并自动升序
        for (int s=0;s<jsonObject.getJSONArray("dept_sum").size();s++){
            integers.put(jsonObject.getJSONArray("dept_sum").getJSONObject(s).size(),jsonObject.getJSONArray("dept_sum").getJSONObject(s));
        }

        //将键存入set
        Set<Integer> integers1 = integers.keySet();
        //转换linkedList
        LinkedList<Integer> linkedList=new LinkedList<>(integers1);
        Set<String> stringSet = null;
        //遍历部门对象数组
        for (int b=0;b<jsonObject.getJSONArray("dept_sum").size();b++){
            //判断部门对象键数量是否等于最大部门键数量
            if(jsonObject.getJSONArray("dept_sum").getJSONObject(b).size()==linkedList.getLast()){
                stringSet = jsonObject.getJSONArray("dept_sum").getJSONObject(b).keySet();
                break;
            }
        }





        Iterator<String> stringIterator = stringSet.iterator();
        int poll=0;
        while (stringIterator.hasNext()){
            poll++;
            String next=stringIterator.next();
            if(poll<=2){
                if (next.indexOf("orgcode")>-1) {
                    htmlStringBuffer.append("            <td  title=\"组织编码\">");
                    htmlStringBuffer.append("                组织编码");
                    htmlStringBuffer.append("            </td>");
                }else if (next.indexOf("deptcode")>-1) {
                    htmlStringBuffer.append("            <td  title=\"部门编码\">");
                    htmlStringBuffer.append("                部门编码");
                    htmlStringBuffer.append("            </td>");
                }else if (next.indexOf("deptname")>-1) {
                    htmlStringBuffer.append("            <td  title=\"部门名称\">");
                    htmlStringBuffer.append("                部门名称");
                    htmlStringBuffer.append("            </td>");
                }else if (next.indexOf("orgname")>-1) {
                    htmlStringBuffer.append("            <td  title=\"组织名称\">");
                    htmlStringBuffer.append("                组织名称");
                    htmlStringBuffer.append("            </td>");
                }else if (next.indexOf("psnnum")>-1) {
                    htmlStringBuffer.append("            <td  title=\"人数\">");
                    htmlStringBuffer.append("                人数");
                    htmlStringBuffer.append("            </td>");
                }else {
                    htmlStringBuffer.append("           <td title=\""+next+"\">");
                    htmlStringBuffer.append("                "+next+"");
                    htmlStringBuffer.append("            </td>");
                }
            }else
                //拼接右边部分的标题
                if(poll>=3){
                    if (next.indexOf("orgcode")>-1) {
                        stringBufferTitle.append("            <td  title=\"组织编码\">");
                        stringBufferTitle.append("                组织编码");
                        stringBufferTitle.append("            </td>");
                    }else if (next.indexOf("deptcode")>-1) {
                        stringBufferTitle.append("            <td  title=\"部门编码\">");
                        stringBufferTitle.append("                部门编码");
                        stringBufferTitle.append("            </td>");
                    }else if (next.indexOf("deptname")>-1) {
                        stringBufferTitle.append("            <td  title=\"部门名称\">");
                        stringBufferTitle.append("                部门名称");
                        stringBufferTitle.append("            </td>");
                    }else if (next.indexOf("orgname")>-1) {
                        stringBufferTitle.append("            <td  title=\"组织名称\">");
                        stringBufferTitle.append("                组织名称");
                        stringBufferTitle.append("            </td>");
                    }else if (next.indexOf("psnnum")>-1) {
                        stringBufferTitle.append("            <td  title=\"人数\">");
                        stringBufferTitle.append("                人数");
                        stringBufferTitle.append("            </td>");
                    }else {
                        stringBufferTitle.append("           <td title=\""+next+"\">");
                        stringBufferTitle.append("                "+next+"");
                        stringBufferTitle.append("            </td>");
                    }
                }


        }

        htmlStringBuffer.append("</tr>");
        htmlStringBuffer.append("</table>");



        //第二部分内容
        StringBuffer stringBufferContent=new StringBuffer();
        htmlStringBuffer.append("<div class=\"left-title-dept\">");
        htmlStringBuffer.append("<table class=\"table-dept\" id=\"chanceGridTable1-dept\">");

        //声明数组保存金额做合计处理
        Double[] yuanGongPayDouble=null;
        //标题数据遍历
        for (int a=0;a<jsonObject.getJSONArray("dept_sum").size();a++){


            htmlStringBuffer.append("        <tr>");
            stringBufferContent.append("        <tr>");

            //序号
            htmlStringBuffer.append("            <td title=\""+ (a+1) +"\">");
            htmlStringBuffer.append("                " + (a+1) + "");
            htmlStringBuffer.append("            </td>");

            //json对象获取key集合
            Iterator<String> iterator = stringSet.iterator();

            //给数组初始大小根据td数量
            if(null==yuanGongPayDouble){
                yuanGongPayDouble=new Double[stringSet.size()-2];

            }

            //记录json对象key循环几次
            int zhi=0;
            //金额数组初始下标
            int indexPay=0;
            while (iterator.hasNext()){
                String next=iterator.next();


                zhi++;

                if(zhi<=2){
                    htmlStringBuffer.append("<td title=\""+ jsonObject.getJSONArray("dept_sum").getJSONObject(a).getString(next) +"\">");
                    if(null!=jsonObject.getJSONArray("dept_sum").getJSONObject(a).getString(next)&&!jsonObject.getJSONArray("dept_sum").getJSONObject(a).getString(next).equals("null")){
                        htmlStringBuffer.append("" + jsonObject.getJSONArray("dept_sum").getJSONObject(a).getString(next) + "");
                    }
                    htmlStringBuffer.append("</td>");
                }else
                if(zhi>=3){
                    stringBufferContent.append("<td title=\""+ jsonObject.getJSONArray("dept_sum").getJSONObject(a).getString(next) +"\">");
                    if(null!=jsonObject.getJSONArray("dept_sum").getJSONObject(a).getString(next)&&!jsonObject.getJSONArray("dept_sum").getJSONObject(a).getString(next).equals("null")){
                        stringBufferContent.append("" + jsonObject.getJSONArray("dept_sum").getJSONObject(a).getString(next) + "");
                    }
                    stringBufferContent.append("</td>");


                    //对每个员工金额进行计算
                    try{
                        //是不是金额true则计算否略过
                        String pay=jsonObject.getJSONArray("dept_sum").getJSONObject(a).getString(next);
                        if(pay.indexOf(".")>-1){
                            if(null==yuanGongPayDouble[indexPay]){
                                yuanGongPayDouble[indexPay]=0.00;
                            }
                            yuanGongPayDouble[indexPay]+=Double.valueOf(pay);
                        }else {
                            throw  new RuntimeException("表示金额出错!");
                        }
                    }catch (Exception e){
                        yuanGongPayDouble[indexPay]=null;
                    }
                    indexPay++;
                }
            }

            htmlStringBuffer.append("        </tr>");
            stringBufferContent.append("        </tr>");
        }


        htmlStringBuffer.append("<tr>" +
                "<td  colspan=\"3\"></td>" +
                "</tr>");

        htmlStringBuffer.append("<tr>");
        htmlStringBuffer.append("<td>合计</td>");
        htmlStringBuffer.append("<td></td>");
        htmlStringBuffer.append("<td></td>");
        htmlStringBuffer.append("</tr>");




        //添加最后一行来填充固定几个td
        htmlStringBuffer.append("        <tr>");
        htmlStringBuffer.append("<td style=\"visibility: hidden;\"></td>");
        htmlStringBuffer.append("<td style=\"visibility: hidden;\"></td>");
        htmlStringBuffer.append("<td style=\"visibility: hidden;\"></td>");
        htmlStringBuffer.append("        </tr>");

        htmlStringBuffer.append("</table>");
        htmlStringBuffer.append("</div>");
        htmlStringBuffer.append("</div>");





        //==========右边部分
        //第一部分标题
        htmlStringBuffer.append("<div class=\"right-table-dept\">");
        htmlStringBuffer.append("<div class=\"right-title-dept\">");
        htmlStringBuffer.append("<table class=\"table-dept\" id=\"chanceGridTable2-dept\">");
        htmlStringBuffer.append("<tr>");
        htmlStringBuffer.append(stringBufferTitle.toString());
        htmlStringBuffer.append("<td style=\"visibility: hidden;\"></td>");
        htmlStringBuffer.append("</tr>");


        htmlStringBuffer.append("</table>");
        htmlStringBuffer.append("</div>");





        //第二部分内容
        htmlStringBuffer.append("<div class=\"content-table-dept\">");
        htmlStringBuffer.append("<table class=\"table-dept\" id=\"chanceGridTable3-dept\">");
        htmlStringBuffer.append(stringBufferContent.toString());
        htmlStringBuffer.append("<tr>" +
                "<td  colspan=\""+(stringSet.size()-2)+"\"></td>" +
                "</tr>");

        DecimalFormat decimalFormat=new DecimalFormat("0.00");
        //合计拼接

        htmlStringBuffer.append("<tr>");
        for (Double pay:yuanGongPayDouble){
            if(null!=pay){
                htmlStringBuffer.append("<td title=\""+decimalFormat.format(pay)+"\">"+decimalFormat.format(pay)+"</td>");

            }else {
                htmlStringBuffer.append("<td></td>");
            }
        }
        htmlStringBuffer.append("</tr>");
        htmlStringBuffer.append("</table>");
        htmlStringBuffer.append("</div>");
        htmlStringBuffer.append("</div>");
        htmlStringBuffer.append("</div>");
        htmlStringBuffer.append("</div>");
        return htmlStringBuffer;
    }

    /**
     * 薪资发放收回调用接口
     * @param body
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "recall", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    public String recall(@RequestBody Map<String, String> body, HttpServletRequest request) throws Exception {
        BaseWrapper baseWrapper=new BaseWrapper();
        JSONObject jsonObject=null;
        try {
            // 接收HR的薪资发放接口数据，发到测试环境时要把注释打开
            String requstBody = body.get("requestBody");
            String rsbody = nccloudService.dealResponseBody(requstBody, securityKey, "L4");

            jsonObject = JSON.parseObject(rsbody);
            // 接口调用日志保存
            this.ncclog("",jsonObject.toJSONString(),"薪资发放291收回推来的数据","","1","0");

            //流水号查询
            Map<String,Object> map=new HashedMap();
            map.put("tableName","flow_data_291");
            map.put("pk_hi_stapply",jsonObject.getString("pk_payroll"));
            Map<String, Object> rsmap = workMapper.select(map);
            if(null==rsmap){
                throw new RuntimeException("单据不存在!");
            }

            //流水步骤查询
            map=new HashedMap();
            map.put("runId",rsmap.get("run_id"));
            List<FlowRunPrcs> runPrcs = flowRunPrcsMapper.getFlowRunPrecsOpFlag(map);
            //获取制单人user_id
            String user_id=runPrcs.get(0).getUserId();
            if(null==runPrcs||runPrcs.size()==0){
                throw new RuntimeException("流水步骤表单据不存在!");
            }

            //判断步骤一是什么步骤标识状态为1的未接收，2办理中，3已转交对方未接收，可以收回，4已办结
            if(runPrcs.get(0).getUserId().equals(user_id)&&runPrcs.get(0).getPrcsFlag().equals("3")) {
                //oa回收
                AjaxJson ajaxJson = wfeFlowRunPrcs.workBack(1, 1, runPrcs.get(0).getRunId().toString(), runPrcs.get(0).getUserId(), runPrcs.get(0).getId().toString(), "");
                if(!ajaxJson.isFlag()){
                    throw new RuntimeException("oa薪资发放单据收回失败!");
                }

                //删除单据
                FlowRunPrcs flowRunPrcs=new FlowRunPrcs();
                flowRunPrcs.setId(runPrcs.get(0).getId());
                wfeRunner.getWfeFlowRunPrcs().deleteRunPrcs(flowRunPrcs);

                baseWrapper.setFlag(true);
                baseWrapper.setMsg("制单人已转交，下一步未接收，可以收回");
                baseWrapper.setStatus(true);
                // 接口调用日志保存
                this.ncclog("","","薪资发放291收回成功","已转交对方未接收，可以收回","1","0");
            }else if (runPrcs.get(runPrcs.size()-1).getUserId().equals(user_id)&&runPrcs.get(runPrcs.size()-1).getPrcsFlag().equals("1")){
                //oa回收
                AjaxJson ajaxJson = wfeFlowRunPrcs.workBack(runPrcs.get(runPrcs.size()-2).getPrcsId(), runPrcs.get(runPrcs.size()-2).getFlowPrcs(), runPrcs.get(runPrcs.size()-2).getRunId().toString(), runPrcs.get(runPrcs.size()-2).getUserId(), runPrcs.get(runPrcs.size()-2).getId().toString(), "");
                if(!ajaxJson.isFlag()){
                    throw new RuntimeException("oa薪资发放单据收回失败!");
                }

                //删除单据和流程步骤
                Map<String,Object> mapFlowRunPrcs=new HashMap<>();
                mapFlowRunPrcs.put("runId",runPrcs.get(0).getRunId());
                flowRunPrcsMapper.cancelRunPrcs(mapFlowRunPrcs);
                mapFlowRunPrcs.put("tableName","flow_data_291");
                workMapper.deWork(mapFlowRunPrcs);

                baseWrapper.setFlag(true);
                baseWrapper.setMsg("制单人已转交，下一步未接收，可以收回");
                baseWrapper.setStatus(true);
                // 接口调用日志保存
                this.ncclog("","","薪资发放291收回成功","已转交对方未接收，可以收回","1","0");
            }else{
                throw new RuntimeException("下一步已接收，不可收回!");
            }

        }catch (Exception e){
            //返回信息
            baseWrapper.setFlag(false);
            baseWrapper.setMsg(e.getMessage());
            baseWrapper.setStatus(true);

            // 接口调用日志保存
            this.ncclog("","","薪资发放291收回false",e.getMessage(),"0","0");

        }


        // 根据安全级别选择加密或压缩请求表体参数
        String json =incCloudService.dealRequestBody(JSON.toJSONString(baseWrapper), securityKey, "L4");
        return json;
    }




    /**
     * 日志记录
     * @param businessNo
     * @param content
     * @param name
     * @param result
     * @param state
     * @param disposeState
     * @throws Exception
     */
    public void ncclog(String businessNo,String content,String name,String result,String state,String disposeState )throws Exception{
        NCCInterfaceLog ncclog = new NCCInterfaceLog();
        ncclog.setBusinessNo(businessNo);//保存薪资发放主键
        ncclog.setContent(content);
        ncclog.setName(name);
        ncclog.setResult(result);
        ncclog.setState(state);
        ncclog.setDisposeState(disposeState);
        logService.save(ncclog);
    }






    /**
     * 保存单据信息
     * @param pk
     * @param billsType
     * @param run_id
     * @throws Exception
     */
    public void saveBills(String pk,String billsType,String run_id)throws Exception{
        // 保存主键的动作
        List<String> key = new ArrayList();
        key.add("pk_hi_stapply='"+pk+"'");
        key.add("billsType='"+billsType+"'");
        Map<String, Object> param = new HashMap();
        param.put("tableName", "flow_data_291");
        param.put("keys", key);
        param.put("runId", run_id);
        workMapper.update(param);
    }
    /*
     * 判断字符串中是否含有英文，包含返回true
     */
    public boolean isENChar(String string) {
        boolean flag = false;
        Pattern p = Pattern.compile("[a-zA-z]");
        if(p.matcher(string).find()) {
            flag = true;
        }
        return flag;
    }
    /**
     * 单据动作
     *
     * @param pk       单据主键
     * @param billType 单据类型编码
     * @param action   单据动作名称 ：SAVE=提交 APPROVE=审批 UNAPPROVE=弃审 RECALL=收回 DELETE=删除
     * @return
     * @throws Exception
     */
    @RequestMapping("djdz")
    @ResponseBody
    public BaseWrapper djdz(String pk, String billType, String action) throws Exception {

        BaseWrapper baseWrapper = new BaseWrapper();
        if (StringUtils.isBlank(pk)) {
            baseWrapper.setFlag(false);
            baseWrapper.setStatus(false);
            baseWrapper.setMsg("pk不能为空！");
            return baseWrapper;
        }
        if (StringUtils.isBlank(billType)) {
            baseWrapper.setFlag(false);
            baseWrapper.setStatus(false);
            baseWrapper.setMsg("billType不能为空！");
            return baseWrapper;
        }
        if (StringUtils.isBlank(action)) {
            baseWrapper.setFlag(false);
            baseWrapper.setStatus(false);
            baseWrapper.setMsg("action不能为空！");
            return baseWrapper;
        }

//        String requstBody = "{\"pk\":\"" + pk + "\",\"billType\":\"" + billType + "\",\"checkNote\":\"\",\"approveResult\":\"Y\",\"action\":\"APPROVE\"}";
        String requstBody = "{\"pk\":\"" + pk + "\",\"billType\":\"" + billType + "\",\"checkNote\":\"\",\"approveResult\":\"Y\",\"action\":\"" + action + "\"}";
        String result = nccloudService.sendApi(nccloudService.billactionUrl, requstBody);
        // 接口调用日志保存
        NCCInterfaceLog ncclog = new NCCInterfaceLog();
        ncclog.setBusinessNo(pk);
        ncclog.setContent(requstBody);
        ncclog.setName("单据动作");
        ncclog.setResult(result);
        ncclog.setState("1");
        ncclog.setDisposeState("0");
        logService.save(ncclog);

        baseWrapper.setFlag(true);
        baseWrapper.setMsg("成功");
        baseWrapper.setStatus(true);
        baseWrapper.setData(result);
        return baseWrapper;
    }

    /**
     * 添加定调资信息维护
     *
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping("dtjxx")
    @ResponseBody
    public BaseWrapper dtjxx(HttpServletRequest request) throws Exception {

        String requstBody = "[{\"pk_org\":\"1\",\"pk_group\":\"0001A210000000000GQS\",\"pk_psndoc\":\"00004505\",\"pk_wa_crt\":\"1001A6100000002QXB1O\",\"pk_wa_crt_showname\":\"3-4\",\"pk_wa_grd\":\"1001A6100000002QXB19\",\"pk_wa_item\":\"1001A6100000002QXAXY\",\"waflag\":\"Y\",\"begindate\":\"2021-05-11\",\"enddate\":\"2021-05-13\",\"criterionvalue\":\"1450.00\",\"lastflag\":\"Y\",\"negotiation_wage\":\"N\",\"nmoney\":\"1450.00\",\"partflag\":\"N\",\"pk_wa_prmlv\":\"1001A6100000002QXB1G\",\"changedate\":\"2021-05-12\",\"vbasefile\":\"测试文件\"},{\"pk_org\":\"1\",\"pk_group\":\"0001A210000000000GQS\",\"pk_psndoc\":\"10000006\",\"pk_wa_crt\":\"1001A6100000002QXB1O\",\"pk_wa_crt_showname\":\"3-4\",\"pk_wa_grd\":\"1001A6100000002QXB19\",\"pk_wa_item\":\"1001A6100000002QXAXY\",\"waflag\":\"Y\",\"begindate\":\"2021-05-11\",\"enddate\":\"2021-05-13\",\"criterionvalue\":\"1450.00\",\"lastflag\":\"Y\",\"negotiation_wage\":\"N\",\"nmoney\":\"1450.00\",\"partflag\":\"N\",\"pk_wa_prmlv\":\"1001A6100000002QXB1G\",\"changedate\":\"2021-05-12\",\"vbasefile\":\"测试文件\"}]";
        String result = nccloudService.sendApi(nccloudService.psndocWadocManageUrl, requstBody);
        // 接口调用日志保存
        NCCInterfaceLog ncclog = new NCCInterfaceLog();
        ncclog.setBusinessNo("1001ZZ100000002R2LFJ"); //保存单据主键
        ncclog.setContent(requstBody);
        ncclog.setName("添加定调资信息维护");
        ncclog.setResult(result);
        ncclog.setState("1");
        ncclog.setDisposeState("0");
        logService.save(ncclog);

        BaseWrapper baseWrapper = new BaseWrapper();
        baseWrapper.setFlag(true);
        baseWrapper.setMsg("成功");
        baseWrapper.setStatus(true);
        baseWrapper.setData(result);
        return baseWrapper;
    }

    /**
     * 新增人员调动办理
     *
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping("rydd")
    @ResponseBody
    public BaseWrapper rydd(HttpServletRequest request) throws Exception {
        String reqeustBody = "{\"billhead\":{\"apply_date\":\"2021-05-17\",\"bill_code\":\"LZ202105009\",\"effectdate\":\"2021-05-18\",\"ifaddblack\":\"N\",\"ifaddpsnchg\":\"N\",\"ifendpart\":\"N\",\"ifsynwork\":\"N\",\"isdisablepsn\":\"Y\",\"isend\":\"N\",\"ishrssbill\":\"N\",\"isneedfile\":\"N\",\"isrelease\":\"N\",\"trial_flag\":\"N\",\"newpk_dept\":\"~\",\"newpk_job\":\"~\",\"newpk_job_type\":\"~\",\"newpk_org\":\"108\",\"newpk_psncl\":\"0206\",\"newpoststat\":\"N\",\"memo\":\"离职说明\",\"newdeposemode\":\"1\",\"newjobmode\":\"~\",\"newmemo\":\"备注\",\"pk_billtype\":\"6115\",\"pk_group\":\"0001A210000000000GQS\",\"pk_org\":\"108\",\"pk_psndoc\":\"10800009\",\"pk_trnstype\":\"0302\",\"sreason\":\"01\",\"stapply_mode\":\"1\",\"pk_hi_stapply\":\"\",\"workflow_state\":\"-1\",\"assgid\":\"1\",\"billmaker\":\"yylh\"}}";
        String result = nccloudService.sendApi(nccloudService.psnStapplyUrl, reqeustBody);
        BaseWrapper baseWrapper = new BaseWrapper();
        // 接口调用日志保存
        NCCInterfaceLog ncclog = new NCCInterfaceLog();
        ncclog.setBusinessNo("1001ZZ100000002R2LFJ"); //保存单据主键
        ncclog.setContent(reqeustBody);
        ncclog.setName("新增人员调动办理");
        ncclog.setResult(result);
        ncclog.setState("1");
        ncclog.setDisposeState("0");
        logService.save(ncclog);

        baseWrapper.setFlag(true);
        baseWrapper.setMsg("成功");
        baseWrapper.setStatus(true);
        baseWrapper.setData(result);
        return baseWrapper;
    }

    /***
     * 新增人员离职办理
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping("rylz")
    @ResponseBody
    public BaseWrapper rylz(HttpServletRequest request) throws Exception {
        String reqeustBody = "{\"billhead\":{\"addreason\":\"\",\"apply_date\":\"2021-04-21\",\"bill_code\":\"LZ202104234\",\"effectdate\":\"2022-05-01\",\"ifaddpsnchg\":\"N\",\"ifendpart\":\"N\",\"ifsynwork\":\"Y\",\"isdisablepsn\":\"Y\",\"isend\":\"N\",\"ishrssbill\":\"N\",\"isneedfile\":\"N\",\"isrelease\":\"N\",\"trial_flag\":\"N\",\"newpk_dept\":\"0101\",\"newpk_job\":\"~\",\"newpk_job_type\":\"~\",\"newpk_jobgrade\":\"~\",\"newpk_jobrank\":\"~\",\"newpk_org\":\"108\",\"newpk_post\":\"GW011\",\"newpk_postseries\":\"01\",\"newpk_psncl\":\"0101\",\"newpoststat\":\"Y\",\"newseries\":\"~\",\"pk_billtype\":\"6115\",\"pk_group\":\"0001A210000000000GQS\",\"pk_hi_org\":\"108\",\"pk_hi_stapply\":\"\",\"pk_hrcm_org\":\"108\",\"pk_old_hi_org\":\"108\",\"pk_old_hrcm_org\":\"108\",\"pk_org\":\"108\",\"pk_psndoc\":\"10800009\",\"pk_trnstype\":\"0201\",\"sreason\":\"02\",\"stapply_mode\":\"1\",\"assgid\":\"1\",\"workflow_state\":\"-1\",\"billmaker\":\"yylh\"}}";
//        String reqeustBody = "{}";
        String result = nccloudService.sendApi(nccloudService.psnLeaveUrl, reqeustBody);

        // 接口调用日志保存
        NCCInterfaceLog ncclog = new NCCInterfaceLog();
        ncclog.setBusinessNo("1001ZZ100000002R2LFJ"); //保存单据主键
        ncclog.setContent(reqeustBody);
        ncclog.setName("新增人员离职办理");
        ncclog.setResult(result);
        ncclog.setState("1");
        ncclog.setDisposeState("0");
        logService.save(ncclog);

        BaseWrapper baseWrapper = new BaseWrapper();
        baseWrapper.setFlag(true);
        baseWrapper.setMsg("成功");
        baseWrapper.setStatus(true);
        baseWrapper.setData(result);
        return baseWrapper;
    }

    /***
     * 员工转正申请
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping("regApply")
    @ResponseBody
    public BaseWrapper regApply(HttpServletRequest request) throws Exception {
        String reqeustBody = "{\"billhead\":{\"addreason\":\"\",\"apply_date\":\"2021-04-21\",\"bill_code\":\"LZ202104234\",\"effectdate\":\"2022-05-01\",\"ifaddpsnchg\":\"N\",\"ifendpart\":\"N\",\"ifsynwork\":\"Y\",\"isdisablepsn\":\"Y\",\"isend\":\"N\",\"ishrssbill\":\"N\",\"isneedfile\":\"N\",\"isrelease\":\"N\",\"trial_flag\":\"N\",\"newpk_dept\":\"0101\",\"newpk_job\":\"~\",\"newpk_job_type\":\"~\",\"newpk_jobgrade\":\"~\",\"newpk_jobrank\":\"~\",\"newpk_org\":\"108\",\"newpk_post\":\"GW011\",\"newpk_postseries\":\"01\",\"newpk_psncl\":\"0101\",\"newpoststat\":\"Y\",\"newseries\":\"~\",\"pk_billtype\":\"6115\",\"pk_group\":\"0001A210000000000GQS\",\"pk_hi_org\":\"108\",\"pk_hi_stapply\":\"\",\"pk_hrcm_org\":\"108\",\"pk_old_hi_org\":\"108\",\"pk_old_hrcm_org\":\"108\",\"pk_org\":\"108\",\"pk_psndoc\":\"10800009\",\"pk_trnstype\":\"0201\",\"sreason\":\"02\",\"stapply_mode\":\"1\",\"assgid\":\"1\",\"workflow_state\":\"-1\",\"billmaker\":\"yylh\"}}";
        String result = nccloudService.sendApi(nccloudService.regApplyUrl, reqeustBody);

        // 接口调用日志保存
        NCCInterfaceLog ncclog = new NCCInterfaceLog();
        ncclog.setBusinessNo("1001ZZ100000002R2LFJ"); //保存单据主键
        ncclog.setContent(reqeustBody);
        ncclog.setName("员工转正申请");
        ncclog.setResult(result);
        ncclog.setState("1");
        ncclog.setDisposeState("0");
        logService.save(ncclog);

        BaseWrapper baseWrapper = new BaseWrapper();
        baseWrapper.setFlag(true);
        baseWrapper.setMsg("成功");
        baseWrapper.setStatus(true);
        baseWrapper.setData(result);
        return baseWrapper;
    }

    /***
     * 工资条信息查询全部
     * @return
     * @throws Exception
     */
    @RequestMapping("ctsalaryData")
    @ResponseBody
    public ToJson ctsalaryData(HttpServletRequest request) throws Exception {
        ToJson toJson=new ToJson();
        try {
            Users users = SessionUtils.getSessionInfo(request.getSession(),Users.class,new Users());
            Map<String,Object> map=new HashMap<>();
            map.put("tableName","ct_salary");
            map.put("condition",(Map)JSON.parse("{\"name_2\":\""+users.getUserName()+"\",\"szbm_3\":\""+users.getDeptName()+"\"}"));
            //公共查询表方法返回全部信息，传入表名
            List<Map<String,Object>> maps= nccloudService.selectAll(map);
            toJson.setData(maps);
            toJson.setFlag(0);
        }catch (Exception e){
            toJson.setFlag(1);
            toJson.setMsg(e.getMessage());
        }
        return toJson;
    }

    @RequestMapping("ctsalary")
    public ModelAndView ctsalary(HttpServletRequest request) throws Exception {

        return new ModelAndView("app/nccloud/ctsalary");
    }

    /**
     * 查询城投工资条
     * @param  cyear 查询年份 cperiod 查询月份 pk_psndoc 人员主键
     * @return
     * @throws Exception
     */
    @RequestMapping("queryCTSalary")
    @ResponseBody
    public BaseWrapper getCTSalaryByUserId() throws Exception {

//        Users users = SessionUtils.getSessionInfo(request.getSession(),Users.class,new Users());
//        String pkpsndoc = psndocService.getPkpsndocByUserId(users.getUserId());
//        if (pkpsndoc == null){
//            throw new RuntimeException("用户工资条查询失败");
//            body.put("pk_psndoc",pkpsndoc);
//        }
//        String reqeustBody = body.toString();
        String reqeustBody = "{\"cyear\":\"2021\",\"cperiod\":\"01\",\"pk_psndoc\":\"1001A4100000002LFRYI\"}";
        String result = nccloudService.sendApi(nccloudService.queryWagesTipUrl,reqeustBody);
        // 调用日志保存
        NCCInterfaceLog nccInterfaceLog = new NCCInterfaceLog();
        nccInterfaceLog.setBusinessNo("ct_salary");
        nccInterfaceLog.setName("查询工资条");
        nccInterfaceLog.setContent(reqeustBody);
        nccInterfaceLog.setResultLong(result);
        nccInterfaceLog.setState("1");
        nccInterfaceLog.setDisposeState("0");
        logService.save(nccInterfaceLog);


        BaseWrapper baseWrapper = new BaseWrapper();
        baseWrapper.setFlag(true);
        baseWrapper.setMsg("成功");
        baseWrapper.setStatus(true);
        baseWrapper.setData(result);
        return baseWrapper;
    }





}